wayland: fix error handling for memfd_create
authorRay Strode <rstrode@redhat.com>
Mon, 16 May 2016 14:20:10 +0000 (10:20 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 16 Jun 2016 16:00:24 +0000 (12:00 -0400)
commitbb2ca3b94d53c009c78d0f364c41ae0220ea2c9e
tree395d9430bb762744cfdada37d024f8f325643e25
parent080fdfa7f9495fc6cc8c286cbfefc7ecf6d61656
wayland: fix error handling for memfd_create

We currently use syscall() directly to invoke memfd_create,
since the function isn't available in libc headers yet.

The code, though, mishandles how errors are passed from syscall().
It assumes syscall returns the error code directly (but negative),
when in fact, syscall() uses errno.

Also, the code fails to retry on EINTR.

This commit moves the handling of memfd create to a helper function,
and changes the code to use errno and handle EINTR.

https://bugzilla.gnome.org/show_bug.cgi?id=766341
gdk/wayland/gdkdisplay-wayland.c